<template>
   <el-input-number
        v-model="currentValue"
        :size="size"
        :step="step"
        :disabled="disabled"
        :placeholder="placeholder">
    </el-input-number>
</template>

<script>
export default {
    name: 'qtNumber',
    props: {
        fildeName: {
            type: String
        },
        value: {
            type: [String, Number]
        },
        placeholder: {
            type: String,
        },
        step: {
            type: Number
        },
        size: {
            type: String,
            default: 'mini'
        },
        disabled: {
            type: [Boolean, String],
            default: false
        }
    },
    data() {
        return {
            currentValue: '',
        }
    },

    //生命周期 - 创建完成（访问当前this实例）
    created () {
        this.currentValue = this.value
    },

    methods: {
        handleChange () {
            this.$emit('change', this.currentValue, this.fildeName)
            this.$emit('input', this.currentValue, this.fildeName)
        },
        handleBlur () {
            this.$emit('input', this.currentValue, this.fildeName)
        }
    },
}
</script>
